package com.jsh.erp.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.web.reactive.function.client.WebClientCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class WebClientCustomizerConfig {

    @Value("${spring.ai.dashscope.api-key}")
    private String api_key;

    @Bean
    public WebClientCustomizer webClientCustomizer() {
        //阿里云百炼远程mcp需要配置apikey
        return webClientBuilder -> webClientBuilder
                .baseUrl("https://dashscope.aliyuncs.com/api/v1/mcps/WebSearch/sse")
                .defaultHeader("Authorization", "Bearer " + api_key);
    }


}
